<template>
<div>
  <h1>注册登录页面</h1>
  <form action="" v-model="from" @click.prevent="btn">
    <p><input type="text" v-model="from.name">请输入用户名</p>
    <p><input type="text" v-model="from.password">请输入密码</p>
    <p><button type="submit">确认</button></p>
  </form>
</div>
</template>

<script>
export default {
name: "user",
  data(){
  return{
    data:"",
    from:{},
    name:localStorage.getItem("name"),
    password:localStorage.getItem("password")
    }
  },
  methods:{
  btn(){
    let name=this.from.name
    let password=this.from.password
    this.axios.post("users_s/",this.from).then(
      res=>{
        console.log(res)
        localStorage.setItem(name,"name")
        localStorage.setItem(password,"password")
      }
    )
    this.$router.push({path:"new_xq/"})
  }
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>
